package vip.liux.contracts.infrastructure.messaging.interceptors;

import lombok.Setter;
import org.jetbrains.annotations.NotNull;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.ChannelInterceptor;
import vip.liux.contracts.repositories.messaging.MessageTaskRepository;

public class RecordChannelInterceptor implements ChannelInterceptor {

    @Setter
    private MessageTaskRepository messageTaskRepository = MessageTaskRepository.INSTANCE;

    @Override
    public Message<?> preSend(@NotNull Message<?> message, @NotNull MessageChannel channel) {
        return message;
    }

    @Override
    public void postSend(@NotNull Message<?> message, @NotNull MessageChannel channel, boolean sent) {

    }

    @Override
    public void afterSendCompletion(@NotNull Message<?> message, @NotNull MessageChannel channel, boolean sent, Exception ex) {
    }
}